import type { postOrPutType } from "@/constants";
import type { HasId, IList, IResult } from "@/types/common";
import { getAxios, commonAxiosJson } from "@/utils/request.ts";
/* 前端账户 地址 */
const url = "/back/user";
/* 获取 前端账户 列表信息 */
export const getAppUserInfo = <T, D>(params: D): Promise<IResult<IList<T>>> => {
  return getAxios<IList<T>, D>(url, params);
};
/*前端账户：通过id获取前端账户详情信息 */
export const getAppUserByIdInfo = <T, D extends HasId>(params: D): Promise<IResult<T>> => {
  return getAxios<T, D>(url + "/" + params.id, params);
};
/* 前端账户 修改前端账户信息 */
export const commonAppUserInfo = <T, D>(params: D, type: postOrPutType): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url, params, type);
};
/* 前端账户 用户解绑店铺 信息 */
export const putAppUserUnbindStoreInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url + "/unbind", params, "PUT");
};
/* 前端账户 修改手机号 信息 */
export const putChangePhoneInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url + "/modify-user-mobile", params, "PUT");
};
